/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.analysis.situation.erp;

public class ERPReportDataSource{
	
}
/**
import cn.ekuma.epos.analysis.situation.I_FilterAble;
import cn.ekuma.epos.businesslogic.OrderUtil;
import cn.ekuma.epos.datalogic.I_DataLogicERP;
import com.calipso.reportgenerator.common.ReportFilterBuilder;
import com.calipso.reportgenerator.common.exception.InfoException;
import com.calipso.reportgenerator.reportcalculator.IDataSource;
import com.calipso.reportgenerator.reportcalculator.Matrix;
import com.calipso.reportgenerator.reportcalculator.shareddata.SharedFloat;
import com.calipso.reportgenerator.reportmanager.ReportDataSource;
import com.openbravo.data.basic.BasicException;
import com.openbravo.format.Formats;
import com.openbravo.bean.erp.viewbean.ERPAnalysisInfo;
import java.util.Calendar;
import java.util.Date;
import java.util.List;


public class ERPReportDataSource extends ReportDataSource implements I_FilterAble{
    Object[] aFilter;
    int dateFormatType;
    Calendar cal;
    I_DataLogicERP  dlSales;
    public ERPReportDataSource(I_DataLogicERP  dlSales) {
        this.dlSales=dlSales;
        cal=Calendar.getInstance();
    }

    @Override
    public IDataSource getDataSource(Matrix matrix) throws InfoException {
        try {
            List<ERPAnalysisInfo> datas =dlSales.list(ERPAnalysisInfo.class,aFilter);
            for (ERPAnalysisInfo entry : datas) {
                Object[] row = new Object[10];
                row[0] = entry.getOrderTypeName();
                row[1] = entry.getOrderType()==0?OrderUtil.ORDERTYPE_Normal:OrderUtil.ORDERTYPE_Revoerse;
                row[2] = getDateStringForType(entry.getCurDate());
                row[3] = entry.getLocalName()==null?"?":entry.getLocalName();
                row[4] = entry.getUserName();
                row[5] = entry.getCustomerName()==null?"?":entry.getCustomerName();
                row[6] = entry.getProductName()==null?"?":entry.getProductName();
                row[7] = entry.getProdCategoresName()==null?"?":entry.getProdCategoresName();
                row[8] = SharedFloat.newFrom(entry.getUnit());
                row[9] = SharedFloat.newFrom(entry.getTotalPrice());
                if ((getFilter() == null) || ((getFilter() != null) && (getFilter().matches(row)))) {
                    matrix.add(row);
                }
            }
        } catch (BasicException ex) {
             throw new InfoException(ex);
        }
        return matrix;
    }

    public String getDateStringForType(Date inDate){
        this.cal.setTime(inDate);
        String ret=String.valueOf(cal.get(Calendar.YEAR));
        switch(dateFormatType){
            case Calendar.DATE:
                return Formats.DATE.formatValue(inDate);
            case Calendar.WEEK_OF_YEAR:
                return ret+="-"+cal.get(Calendar.WEEK_OF_YEAR);
            case Calendar.MONTH:
                return ret+="-"+cal.get(Calendar.MONTH);
            case Calendar.YEAR:
                return ret;
        }
        return Formats.TIMESTAMP.formatValue(inDate);
    }

    @Override
    public int getFilterVarMode() {
        return ReportFilterBuilder.VARMODE_EXTERNALDATA;
    }

    public void setFilter(Object fitler){
        this.aFilter=(Object[])fitler;
        this.dateFormatType=(Integer)aFilter[aFilter.length-1];
    }
}
**/